package edu.aysf.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

// nacos的配置修改后，动态刷新到本地
@RequestMapping("/pay")
@RestController
// 动态刷新nacos配置的值到本地
@RefreshScope
public class HelloController {

    // 默认值为hello
//    @Value("${msg:hello}")
    // 注入nacos配置中心的值
    @Value("${msg}")
    private String message;

    @RequestMapping("/hello")
    public String getMessage() {
        return message;
    }

    @RequestMapping("/hello2")
    public String getMessage2() {
        return "hello2";
    }

}
